package rsj.interceptor;

import com.rlyy.aibase.utils.base.Box;
import common.util.BoxUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import rsj.interceptor.export.IExportParamCheck;
import rsj.interceptor.export.ReportParam;
import rsj.utils.RedisUtils;

/**
 * 转发导出请求
 *
 * @author yuanqinglong
 * @since 2021/8/3 16:40
 */
@Component
public class ForwardExport extends AbstractForwardExport {


    private static final Logger logger = LoggerFactory.getLogger(ForwardExport.class);



    /**
     * 转发导出
     *
     * @param param 参数
     * @return {@link Box}
     */
    @Override
    public Box forwardExport(Box param) throws Exception {
        IExportParamCheck exportParamCheck = EXPORT_CHECK.get(param.getApi());
        exportParamCheck.verify(param, ReportParam.class, (Class<?>) null);
        RedisUtils.lSet(TASK_LIST_KEY, param.toJson());
        return BoxUtil.successBox(param, "文件正在生成中");
    }
}
